﻿// Copyright (c) egmkang wang. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace XServer.GrainInterfaces
{
    using System.Threading.Tasks;
    using Orleans;

    public interface IServerGrain : IGrainWithIntegerKey
    {
        /// <summary>
        /// 玩家在线
        /// </summary>
        /// <param name="playerID">玩家ID</param>
        /// <returns>TaskDone</returns>
        Task PlayerOnline(long playerID);

        /// <summary>
        /// 玩家离线
        /// </summary>
        /// <param name="playerID">玩家ID</param>
        /// <returns>TaskDone</returns>
        Task PlayerOffline(long playerID);

        /// <summary>
        /// 获取玩家对象数量
        /// </summary>
        /// <returns>玩家对象的数量</returns>
        Task<int> GetPlayerCount();

        /// <summary>
        /// 获取在线的玩家数量(距离上次心跳小于1分钟算在线)
        /// </summary>
        /// <returns>在线的玩家数量</returns>
        Task<int> GetOnlinePlayerCount();
    }
}
